
import java.math.BigDecimal;




/**
 * @author nizar
 *
 */
public class AssignExpr extends Expr {

	private Id id;
	private Expr expr; 

	public AssignExpr(Id id, Expr expr) {
		this.id = id;
		this.expr = expr;
	}


	@Override
	public BigDecimal evaluate(Env env) {
		return env.put(id, expr.evaluate(env));

	}

	public static AssignExpr _ (Id id, Expr expr){
		return new AssignExpr(id, expr);
	}

	@Override
	public String toString() {

		return id.getValue()+" = "+ expr.toString();
	}



	@Override
	public boolean isUnExpr() {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public boolean isAssignExpr() {
		// TODO Auto-generated method stub
		return true;
	}

	@Override
	public boolean isPlusBinExpr() {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public boolean isMinusBinExpr() {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public boolean isTimesBinExpr() {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public boolean isDivideBinExpr() {
		// TODO Auto-generated method stub
		return false;
	}


	@Override
	public boolean isNum() {
		// TODO Auto-generated method stub
		return false;
	}


	@Override
	public boolean isId() {
		// TODO Auto-generated method stub
		return false;
	}


	@Override
	public boolean isSeqExpr() {
		// TODO Auto-generated method stub
		return false;
	}



}






